home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 23.zip
/
BS1 part 23
/
Hisoft Basic v1.03 disk 2.adf
/
Video
/
VideoIFF.BAS
< prev
next >
Wrap
BASIC Source File
|
1988-12-03
|
10KB
|
449 lines
' HiSoft BASIC version:
' label Select has been changed to XSelect
' label Loop has been changed to XLoop
rem $option v-
Setup:
Colors=5
d=15 : MaxColors=(2^Colors)-1
TextColor=1
SCREEN CLOSE 2
SCREEN 2,320,200,Colors,1 : WINDOW 2,"Videotitle",,28,2
DIM Text$(d),Colormatrix(31,3),Move(d),Speed(d)
Filler$=STRING$(16,"-")
Colormatrix(1,1)=15
Colormatrix(1,2)=15
Colormatrix(1,3)=15
Begin:
PRINT "Videotitle-Program"
PRINT "by Hannes R"CHR$(252)"gheimer"
PRINT
XSelect:
PRINT "Select:"
PRINT "1 Enter Text"
PRINT "2 Read Object"
PRINT "3 Move Object"
PRINT "4 Define Color"
PRINT "5 Show Title"
PRINT "6 Load Background Picture"
PRINT "7 Read title sequence"
PRINT "8 Store title sequence"
PRINT
Query:
LOCATE 13,1
PRINT "Enter number:";
INPUT a$
a$=LEFT$(a$,1)
IF a$<"1" OR a$>"8" THEN BEEP: GOTO Query
IF a$="1" THEN EnterText
IF a$="2" THEN ReadObject
IF a$="3" THEN DefineMoveObject
IF a$="4" THEN DefineColor
IF a$="5" THEN ShowTitle
IF a$="6" THEN SetupScreen
IF a$="7" THEN ReadTitle
IF a$="8" THEN StoreTitle
GOTO Query
EnterText:
CLS:PRINT "How many lines" : INPUT "of text (1-15)";NoofLines$
IF NoofLines$= "" THEN CLS: GOTO Begin
NoofLines=VAL(NoofLines$)
IF NoofLines<1 OR NoofLines>15 THEN BEEP: GOTO EnterText
FOR x=1 TO NoofLines
LINE INPUT "Text:";Text$(x)
NEXT x : CLS : GOTO Begin
ReadObject:
CLS
PRINT "Enter the name of the" : PRINT "object you want to load."
INPUT Objname$
IF Objname$="" THEN CLS : GOTO Begin
OPEN Objname$ FOR INPUT AS 1
OBJECT.SHAPE 1,INPUT$(LOF(1),1)
CLOSE 1
ObjFlag=1 : CLS : GOTO Begin
DefineMoveObject:
CLS:IF ObjFlag=0 THEN BEEP ELSE Mover
PRINT "No object currently in memory!"
PRINT "Press any key."
Pause:
a$=INKEY$
IF a$="" THEN Pause
CLS: GOTO Begin
Mover:
PRINT "Move the object to it's"
PRINT "starting point using"
PRINT "the cursor keys."
PRINT "When located press <RETURN>"
ox=100 : oy=100 : Destination=0
OBJECT.HIT 1,0,0
OBJECT.ON 1
OBJECT.STOP 1
XLoop:
a$=INKEY$
IF a$=CHR$(13) THEN DestDef
IF a$=CHR$(28) THEN oy=oy-2
IF a$=CHR$(31) THEN ox=ox-5
IF a$=CHR$(30) THEN ox=ox+5
IF a$=CHR$(29) THEN oy=oy+2
OBJECT.X 1,ox : OBJECT.Y 1,oy
GOTO XLoop
DestDef:
CLS
Move(Destination*2+1)=ox : Move(Destination*2+2)=oy
Destination=Destination+1 : Move(0)=Destination
IF Destination=7 THEN Enddef
PRINT "Move the object to location"Destination
PRINT "<RETURN> = Set another location"
PRINT "<ESC> = End"
Loop2:
a$=INKEY$
IF a$=CHR$(13) THEN DestDef
IF a$=CHR$(27) THEN Enddef
IF a$=CHR$(28) THEN oy=oy-2
IF a$=CHR$(31) THEN ox=ox-5
IF a$=CHR$(30) THEN ox=ox+5
IF a$=CHR$(29) THEN oy=oy+2
OBJECT.X 1,ox : OBJECT.Y 1,oy
GOTO Loop2
Enddef:
Move(0)=Destination
OBJECT.OFF 1
CLS : GOTO Begin
DefineColor:
CLS:PRINT "Color values:"
FOR x=0 TO MaxColors
IF (x/8)=INT(x/8) THEN PRINT
COLOR -(x=0),x
PRINT x;
IF x<10 THEN PRINT CHR$(32);
NEXT x
ColorChange:
LOCATE 7,1:COLOR TextColor,Background
PRINT "Enter the number of the color"
PRINT "you want to change."
PRINT "(e = End)"; : BEEP
INPUT Answer$
IF UCASE$(Answer$)="E" THEN AssignColor
Answer$=LEFT$(Answer$,2)
ColorNumber=VAL(Answer$)
IF ColorNumber<0 OR ColorNumber>MaxColors THEN BEEP: GOTO ColorChange
RGBRegulator:
r=Colormatrix(ColorNumber,1)
g=Colormatrix(ColorNumber,2)
b=Colormatrix(ColorNumber,3)
LOCATE 11,1: PRINT "Red: <7>=- <8>=+ ":PRINT Filler$
LOCATE 12,r+1 : PRINT CHR$(124);
LOCATE 13,1: PRINT "Green: <4>=- <5>=+ ":PRINT Filler$
LOCATE 14,g+1 : PRINT CHR$(124);
LOCATE 15,1: PRINT "Blue: <1>=- <2>=+ ":PRINT Filler$
LOCATE 16,b+1 : PRINT CHR$(124);
LOCATE 17,1: PRINT " <0>=Color o.k."
PALETTE ColorNumber,r/16,g/16,b/16
EnterKeys:
Key$=INKEY$
IF Key$="" THEN EnterKeys
IF Key$="7" THEN r=r-1
IF Key$="8" THEN r=r+1
IF Key$="4" THEN g=g-1
IF Key$="5" THEN g=g+1
IF Key$="1" THEN b=b-1
IF Key$="2" THEN b=b+1
IF Key$="0" THEN ColorChange
IF r<0 THEN r=0
IF r>15 THEN r=15
IF g<0 THEN g=0
IF g>15 THEN g=15
IF b<0 THEN b=0
IF b>15 THEN b=15
Colormatrix(ColorNumber,1)=r
Colormatrix(ColorNumber,2)=g
Colormatrix(ColorNumber,3)=b
GOTO RGBRegulator
AssignColor:
a=Background : a$="Background"
GOSUB EnterColor:Background=a
a=TextColor : a$="Text Color"
GOSUB EnterColor:TextColor=a
a=TextBackground : a$="Text Background"
GOSUB EnterColor:TextBackground=a
COLOR TextColor,Background
CLS : GOTO Begin
EnterColor:
LOCATE 19,1
PRINT a$": ";a
Loop3:
LOCATE 19,1
PRINT a$; : INPUT Answer$
Answer=VAL(Answer$)
IF Answer$="" THEN Answer=.5
IF Answer<0 OR Answer>MaxColors THEN BEEP : GOTO Loop3
IF Answer<>.5 THEN a=Answer
RETURN
ShowTitle:
CLS
PRINT "Press the <RETURN> key"
PRINT "to begin showing the title."
WaitforKey:
a$=INKEY$
IF a$=CHR$(13) THEN CLS : c=10 :GOTO Countdown
GOTO WaitforKey
Countdown:
LOCATE 10,15 : PRINT c
c=c-1:IF c<0 THEN StartDisplay
Tim=INT(TIMER)
Wait2:
IF INT(TIMER)=Tim THEN Wait2
GOTO Countdown
StartDisplay:
WIDTH 32
COLOR TextColor,Background : CLS
COLOR TextColor,TextBackground
IF IFF=1 THEN CALL DrawLoad
FOR x=1 TO NoofLines
Text$=LEFT$(Text$(x),32)
h=INT((32-LEN(Text$))/2)+2
LOCATE x+17-NoofLines,h : PRINT Text$
NEXT x
COLOR TextColor,Background
IF Move(0)=0 THEN MoveText
OBJECT.X 1,Move(1)
OBJECT.Y 1,Move(2)
OBJECT.ON 1
FOR x=1 TO Move(0)-1
OBJECT.STOP 1
GOSUB VelocityCalc
OBJECT.X 1,Move(x*2-1)
OBJECT.Y 1,Move(x*2)
OBJECT.VX 1,Speed(x*2-1)
OBJECT.VY 1,Speed(x*2)
OBJECT.HIT 1,0,0
OBJECT.START 1
Tst=TIMER
Loop4:
px=ABS(Move(x*2+1)-OBJECT.X(1))
py=ABS(Move(x*2+2)-OBJECT.Y(1))
IF INT(TIMER-Tst)<18 AND (px>15 OR py>15) THEN Loop4
NEXT x
OBJECT.OFF 1
MoveText:
Tst=TIMER
IF Move(0)<>0 THEN Finish
Wait3:
IF TIMER-Tst<(2*NoofLines+2) THEN Wait3
Finish:
FOR x=1 TO 30
SCROLL (1,1)-(630,100),0,3
SCROLL (1,100)-(630,180),0,-3
NEXT x
COLOR TextColor,Background
CLS : GOTO Begin
VelocityCalc:
ox=OBJECT.X (1) : oy=OBJECT.Y (1)
Move(x*2-1)=ox : Move(x*2)=oy
zx=Move(x*2+1) : zy=Move(x*2+2)
FOR xx=1 TO 64 STEP .2
Speed(x*2-1)=CINT((zx-ox)/xx)
Speed(x*2)=CINT((zy-oy)/xx)
IF ABS(Speed(x*2-1))<40 AND ABS(Speed(x*2))<40 THEN xx=64
NEXT xx
RETURN
SetupScreen:
CLS
PRINT "Want to load a graphic"
PRINT "background? (Y/N)"
Loop5:
LOCATE 2,19 : INPUT Answ$
IF UCASE$(Answ$)="N" THEN IFF=0 : CLS : GOTO Begin
IF UCASE$(Answ$)="Y" THEN IFF=1 : GOTO EnterName
GOTO Loop5
EnterName:
PRINT
PRINT "Enter name:"
INPUT Nam$
PRINT
PRINT "Use the color table for:"
PRINT Nam$
PRINT "Enter (Y/N)";
Loop6:
LOCATE 9,12 : INPUT Answ$
IF UCASE$(Answ$)="N" THEN IFFTab=0 : CLS : GOTO Begin
IF UCASE$(Answ$)="Y" THEN IFFTab=1 : CLS : GOTO Begin
GOTO Loop6
SUB DrawLoad STATIC
SHARED Colors,Colormatrix(),IFFTab,Nam$
IF Nam$="" THEN EndLoad
OPEN Nam$ FOR INPUT AS 1
Form$=INPUT$(4,1)
Length=CVL(INPUT$(4,1))
IF INPUT$(4,1)<>"ILBM" THEN BEEP : GOTO EndLoad
ReadData:
IF EOF(1) THEN EndLoad
Chunk$=INPUT$(4,1)
Length=CVL(INPUT$(4,1))
IF INT(Length/2)<>(Length/2) THEN Length=Length+1
IF Chunk$="BMHD" THEN BMHeader
IF Chunk$="CMAP" THEN ColorMap
IF Chunk$="BODY" THEN BodyMap
Dummy$=INPUT$(Length,1)
GOTO ReadData
BMHeader:
xd=CVI(INPUT$(2,1))
IF xd>320 THEN EndLoad
yd=CVI(INPUT$(2,1))
IF yd>200 THEN EndLoad
Dummy$=INPUT$(4,1)
Bitplane=ASC(INPUT$(1,1))
Dummy$=INPUT$(11,1)
Addr=PEEKL(WINDOW(8)+4)+8
FOR x=0 TO Bitplane-1
PlaneAddr(x)=PEEKL(Addr+4*x)
NEXT x
GOTO ReadData
ColorMap:
FOR x=0 TO (Length/3)-1
r=(ASC(INPUT$(1,1)) AND 240)/16
g=(ASC(INPUT$(1,1)) AND 240)/16
b=(ASC(INPUT$(1,1)) AND 240)/16
IF IFFTab=1 THEN
PALETTE x,r/16,g/16,b/16
Colormatrix(x,1)=r : Colormatrix(x,2)=g : Colormatrix(x,3)=b
END IF
NEXT x
IF INT(Length/3)<>(Length/3) THEN Dummy$=INPUT$(1,1)
GOTO ReadData
BodyMap:
FOR y1=0 TO 199
FOR b=0 TO Bitplane-1
IF b<Colors THEN
FOR x1=0 TO 9
POKEL PlaneAddr(b)+4*x1+40*y1,CVL(INPUT$(4,1))
NEXT x1
ELSE
Dummy$=INPUT$(40,1)
END IF
NEXT b
NEXT y1
GOTO ReadData
EndLoad:
CLOSE 1
END SUB
StoreTitle:
CLS : PRINT "Save as what name:"
INPUT DatName$
OPEN DatName$ FOR OUTPUT AS 1
PRINT #1,NoofLines : REM Number of text lines
FOR x=1 TO NoofLines
WRITE #1,Text$(x)
NEXT x
PRINT #1,ObjFlag ' Object loaded?
WRITE #1,Objname$ ' file name
PRINT #1,Move(0) ' Number of movements
FOR x=1 TO Move(0)
PRINT #1,Move(x)
NEXT x
PRINT #1,Colors ' Number of Bitplanes
FOR x=0 TO 31 ' 32 Colors in IFF-Storage
PRINT #1,CHR$(Colormatrix(x,1)*16);
PRINT #1,CHR$(Colormatrix(x,2)*16);
PRINT #1,CHR$(Colormatrix(x,3)*16);
NEXT x
PRINT #1,Background ' Text color etc.
PRINT #1,TextColor
PRINT #1,TextBackground
PRINT #1,IFF ' Screen background?
PRINT #1,IFFTab ' Change colors?
WRITE #1,Nam$ ' file name
CLOSE 1
CLS
GOTO Begin
ReadTitle:
CLS : PRINT "Name of file to load:"
INPUT DatName$
OPEN DatName$ FOR INPUT AS 1
INPUT #1,NoofLines
FOR x=1 TO NoofLines
INPUT #1,Text$(x)
NEXT x
INPUT #1,ObjFlag
INPUT #1,Objname$
IF ObjFlag=1 THEN
OPEN Objname$ FOR INPUT AS 2
OBJECT.SHAPE 1,INPUT$(LOF(2),2)
CLOSE 2
END IF
INPUT #1,Move(0)
FOR x=1 TO Move(0)
INPUT #1,Move(x)
NEXT x
INPUT #1,Color1
IF Color1<=Colors THEN Colors=Color1
MaxColors=(2^Colors)-1
FOR x=0 TO 31
r=(ASC(INPUT$(1,1)) AND 240)/16
g=(ASC(INPUT$(1,1)) AND 240)/16
b=(ASC(INPUT$(1,1)) AND 240)/16
PALETTE x,r/16,g/16,b/16
Colormatrix(x,1)=r : Colormatrix(x,2)=g : Colormatrix(x,3)=b
NEXT x
INPUT #1,Background
INPUT #1,TextColor
INPUT #1,TextBackground
INPUT #1,IFF
INPUT #1,IFFTab
INPUT #1,Nam$
CLOSE 1
CLS
GOTO Begin